#! /bin/bash
>ip.txt
password=123456
for i in `seq 100 110`
do
	{
	ip=192.168.1.$i
	ping -c1 -W1 $ip &>/dev/null
	if [ $? -eq 0 ];then
		echo "$ip" >>ip.txt
		/usr/bin/expect <<-EOF
		set timeout 10
		spawn ssh-copy-id $ip
		expect {
			"yes/no" { send "yes\r"; exp_continue }
			"password:" { send "$password\r" }
		}
		expect eof
		EOF
	fi
	}&
done
wait
echo "finish..."
